package cn.edu.ctbu.dp01.service;

import cn.edu.ctbu.dp01.dao.CourseReposity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@Service
public class StudentCourseService {

    private static final Logger logger = LoggerFactory.getLogger(StudentCourseService.class);

    @Autowired
    private CourseReposity courseRepository;

    public List<Object[]> findCourseAndStudent() {
        List<Object[]> resultList = courseRepository.findCourseAndStudent();
            for (Object[] objects : resultList) {
                String studentName = (String) objects[0];
                String courseName = (String) objects[1];
                logger.info("学生姓名: {}, 课程名称: {}", studentName, courseName);
            }
        return resultList;
    }
}
